home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / shmem_sum.z / shmem_sum
Encoding:
Text File  |  2002-10-03  |  24.7 KB  |  278 lines

  1.  
  2. SHMEM_SUM(3)                                                   SHMEM_SUM(3)
  3.  
  4.  
  5. NNNNAAAAMMMMEEEE
  6.      sssshhhhmmmmeeeemmmm____ccccoooommmmpppp4444____ssssuuuummmm____ttttoooo____aaaallllllll,,,, sssshhhhmmmmeeeemmmm____ccccoooommmmpppp8888____ssssuuuummmm____ttttoooo____aaaallllllll,
  7.      sssshhhhmmmmeeeemmmm____ccccoooommmmpppplllleeeexxxxdddd____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____ccccoooommmmpppplllleeeexxxxffff____ssssuuuummmm____ttttoooo____aaaallllllll,
  8.      sssshhhhmmmmeeeemmmm____ddddoooouuuubbbblllleeee____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____ffffllllooooaaaatttt____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____iiiinnnntttt____ssssuuuummmm____ttttoooo____aaaallllllll,
  9.      sssshhhhmmmmeeeemmmm____iiiinnnntttt4444____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____iiiinnnntttt8888____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____lllloooonnnngggg____ssssuuuummmm____ttttoooo____aaaallllllll,
  10.      sssshhhhmmmmeeeemmmm____lllloooonnnnggggddddoooouuuubbbblllleeee____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____lllloooonnnngggglllloooonnnngggg____ssssuuuummmm____ttttoooo____aaaallllllll,
  11.      sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll4444____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll8888____ssssuuuummmm____ttttoooo____aaaallllllll,
  12.      sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll11116666____ssssuuuummmm____ttttoooo____aaaallllllll, sssshhhhmmmmeeeemmmm____sssshhhhoooorrrrtttt____ssssuuuummmm____ttttoooo____aaaallllllll - Performs a sum
  13.      reduction across a set of processing elements (PEs)
  14.  
  15. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  16.      C or C++:
  17.  
  18.         ####iiiinnnncccclllluuuuddddeeee <<<<mmmmpppppppp////sssshhhhmmmmeeeemmmm....hhhh>>>>
  19.  
  20.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ccccoooommmmpppplllleeeexxxxdddd____ssssuuuummmm____ttttoooo____aaaallllllll((((ddddoooouuuubbbblllleeee ccccoooommmmpppplllleeeexxxx ****_t_a_r_g_e_t,,,, ddddoooouuuubbbblllleeee
  21.         ccccoooommmmpppplllleeeexxxx ****_s_o_u_r_c_e,,,, iiiinnnntttt _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt
  22.         _P_E__s_i_z_e,,,, ddddoooouuuubbbblllleeee ccccoooommmmpppplllleeeexxxx ****_p_W_r_k,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  23.  
  24.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ccccoooommmmpppplllleeeexxxxffff____ssssuuuummmm____ttttoooo____aaaallllllll((((ffffllllooooaaaatttt ccccoooommmmpppplllleeeexxxx ****_t_a_r_g_e_t,,,, ffffllllooooaaaatttt ccccoooommmmpppplllleeeexxxx
  25.         ****_s_o_u_r_c_e,,,, iiiinnnntttt _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,,
  26.         ffffllllooooaaaatttt ccccoooommmmpppplllleeeexxxx ****_p_W_r_k,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  27.  
  28.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ddddoooouuuubbbblllleeee____ssssuuuummmm____ttttoooo____aaaallllllll((((ddddoooouuuubbbblllleeee ****_t_a_r_g_e_t,,,, ddddoooouuuubbbblllleeee ****_s_o_u_r_c_e,,,, iiiinnnntttt
  29.         _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, ddddoooouuuubbbblllleeee ****_p_W_r_k,,,,
  30.         lllloooonnnngggg ****_p_S_y_n_c))));;;;
  31.  
  32.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____ffffllllooooaaaatttt____ssssuuuummmm____ttttoooo____aaaallllllll((((ffffllllooooaaaatttt ****_t_a_r_g_e_t,,,, ffffllllooooaaaatttt ****_s_o_u_r_c_e,,,, iiiinnnntttt
  33.         _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, ffffllllooooaaaatttt ****_p_W_r_k,,,,
  34.         lllloooonnnngggg ****_p_S_y_n_c))));;;;
  35.  
  36.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____iiiinnnntttt____ssssuuuummmm____ttttoooo____aaaallllllll((((iiiinnnntttt ****_t_a_r_g_e_t,,,, iiiinnnntttt ****_s_o_u_r_c_e,,,, iiiinnnntttt _n_r_e_d_u_c_e,,,,
  37.         iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, iiiinnnntttt ****_p_W_r_k,,,, lllloooonnnngggg
  38.         ****_p_S_y_n_c))));;;;
  39.  
  40.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____lllloooonnnngggg____ssssuuuummmm____ttttoooo____aaaallllllll((((lllloooonnnngggg ****_t_a_r_g_e_t,,,, lllloooonnnngggg ****_s_o_u_r_c_e,,,, iiiinnnntttt _n_r_e_d_u_c_e,,,,
  41.         iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, lllloooonnnngggg ****_p_W_r_k,,,, lllloooonnnngggg
  42.         ****_p_S_y_n_c))));;;;
  43.  
  44.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____lllloooonnnnggggddddoooouuuubbbblllleeee____ssssuuuummmm____ttttoooo____aaaallllllll((((lllloooonnnngggg ddddoooouuuubbbblllleeee ****_t_a_r_g_e_t,,,, lllloooonnnngggg ddddoooouuuubbbblllleeee
  45.         ****_s_o_u_r_c_e,,,, iiiinnnntttt _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,,
  46.         lllloooonnnngggg ddddoooouuuubbbblllleeee ****_p_W_r_k,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  47.  
  48.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____lllloooonnnngggglllloooonnnngggg____ssssuuuummmm____ttttoooo____aaaallllllll((((lllloooonnnngggg lllloooonnnngggg ****_t_a_r_g_e_t,,,, lllloooonnnngggg lllloooonnnngggg
  49.         ****_s_o_u_r_c_e,,,, iiiinnnntttt _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,,
  50.         lllloooonnnngggg lllloooonnnngggg ****_p_W_r_k,,,, lllloooonnnngggg ****_p_S_y_n_c))));;;;
  51.  
  52.         vvvvooooiiiidddd sssshhhhmmmmeeeemmmm____sssshhhhoooorrrrtttt____ssssuuuummmm____ttttoooo____aaaallllllll((((sssshhhhoooorrrrtttt ****_t_a_r_g_e_t,,,, sssshhhhoooorrrrtttt ****_s_o_u_r_c_e,,,, iiiinnnntttt
  53.         _n_r_e_d_u_c_e,,,, iiiinnnntttt _P_E__s_t_a_r_t,,,, iiiinnnntttt _l_o_g_P_E__s_t_r_i_d_e,,,, iiiinnnntttt _P_E__s_i_z_e,,,, sssshhhhoooorrrrtttt ****_p_W_r_k,,,,
  54.         lllloooonnnngggg ****_p_S_y_n_c))));;;;
  55.  
  56.      Fortran:
  57.  
  58.         IIIINNNNCCCCLLLLUUUUDDDDEEEE """"mmmmpppppppp////sssshhhhmmmmeeeemmmm....ffffhhhh""""
  59.  
  60.         IIIINNNNTTTTEEEEGGGGEEEERRRR _p_S_y_n_c((((SSSSHHHHMMMMEEEEMMMM____RRRREEEEDDDDUUUUCCCCEEEE____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE))))
  61.         IIIINNNNTTTTEEEEGGGGEEEERRRR _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,, _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e
  62.  
  63.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____CCCCOOOOMMMMPPPP4444____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  64.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  65.  
  66.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____CCCCOOOOMMMMPPPP8888____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  67.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  68.  
  69.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____IIIINNNNTTTT4444____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  70.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  71.  
  72.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____IIIINNNNTTTT8888____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  73.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  74.  
  75.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____RRRREEEEAAAALLLL4444____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  76.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  77.  
  78.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____RRRREEEEAAAALLLL8888____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  79.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  80.  
  81.         CCCCAAAALLLLLLLL SSSSHHHHMMMMEEEEMMMM____RRRREEEEAAAALLLL11116666____SSSSUUUUMMMM____TTTTOOOO____AAAALLLLLLLL((((_t_a_r_g_e_t,,,, _s_o_u_r_c_e,,,, _n_r_e_d_u_c_e,,,, _P_E__s_t_a_r_t,,,,
  82.         _l_o_g_P_E__s_t_r_i_d_e,,,, _P_E__s_i_z_e,,,, _p_W_r_k,,,, _p_S_y_n_c))))
  83.  
  84. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  85.      The shared memory (SHMEM) reduction routines compute one or more
  86.      reductions across symmetric arrays on multiple virtual PEs.  A
  87.      reduction performs an associative binary operation across a set of
  88.      values.  For a list of other SHMEM reduction routines, see
  89.      iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3).
  90.  
  91.      As with all SHMEM collective routines, each of these routines assumes
  92.      that only PEs in the active set call the routine.  If a PE not in the
  93.      active set calls a SHMEM collective routine, undefined behavior
  94.      results.
  95.  
  96.      The _n_r_e_d_u_c_e argument determines the number of separate reductions to
  97.      perform.  The source array on all PEs in the active set provides one
  98.      element for each reduction.  The results of the reductions are placed
  99.      in the target array on all PEs in the active set.  The active set is
  100.      defined by the _P_E__s_t_a_r_t, _l_o_g_P_E__s_t_r_i_d_e, _P_E__s_i_z_e triplet.
  101.  
  102.      The _s_o_u_r_c_e and _t_a_r_g_e_t arrays may be the same array, but they may not
  103.      be overlapping arrays.
  104.  
  105.      The arguments are as follows:
  106.  
  107.      _t_a_r_g_e_t      A symmetric array of length _n_r_e_d_u_c_e elements to receive
  108.                  the results of the reduction operations.
  109.  
  110.                  The data type of _t_a_r_g_e_t varies with the version of the
  111.                  reduction routine being called and the language used.
  112.                  When calling from C/C++, refer to the SYNOPSIS section for
  113.                  data type information.  When calling from Fortran, the
  114.                  _t_a_r_g_e_t data types are as follows:
  115.  
  116.                  RRRRoooouuuuttttiiiinnnneeee                       DDDDaaaattttaaaa TTTTyyyyppppeeee
  117.  
  118.                  sssshhhhmmmmeeeemmmm____ccccoooommmmpppp4444____ssssuuuummmm____ttttoooo____aaaallllllll        CCCCOOOOMMMMPPPPLLLLEEEEXXXX((((KKKKIIIINNNNDDDD====4444)))).
  119.  
  120.                  sssshhhhmmmmeeeemmmm____ccccoooommmmpppp8888____ssssuuuummmm____ttttoooo____aaaallllllll        Complex.  If you are using
  121.                                                Fortran, it must be a
  122.                                                default complex value.
  123.  
  124.                  sssshhhhmmmmeeeemmmm____iiiinnnntttt4444____ssssuuuummmm____ttttoooo____aaaallllllll         IIIINNNNTTTTEEEEGGGGEEEERRRR((((KKKKIIIINNNNDDDD====4444)))).
  125.  
  126.                  sssshhhhmmmmeeeemmmm____iiiinnnntttt8888____ssssuuuummmm____ttttoooo____aaaallllllll         Integer.  If you are using
  127.                                                Fortran, it must be a
  128.                                                default integer value.
  129.  
  130.                  sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll4444____ssssuuuummmm____ttttoooo____aaaallllllll        RRRREEEEAAAALLLL((((KKKKIIIINNNNDDDD====4444)))).
  131.  
  132.                  sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll8888____ssssuuuummmm____ttttoooo____aaaallllllll        Real.  If you are using
  133.                                                Fortran, it must be a
  134.                                                default real value.
  135.  
  136.                  sssshhhhmmmmeeeemmmm____rrrreeeeaaaallll11116666____ssssuuuummmm____ttttoooo____aaaallllllll       Real.  If you are using
  137.                                                Fortran, it must be a
  138.                                                default real value.
  139.  
  140.      _s_o_u_r_c_e      A symmetric array, of length _n_r_e_d_u_c_e elements, that
  141.                  contains one element for each separate reduction
  142.                  operation.  The _s_o_u_r_c_e argument must have the same data
  143.                  type as _t_a_r_g_e_t.
  144.  
  145.      _n_r_e_d_u_c_e     The number of elements in the _t_a_r_g_e_t and _s_o_u_r_c_e arrays.
  146.                  _n_r_e_d_u_c_e must be of type integer.  If you are using
  147.                  Fortran, it must be a default integer value.
  148.  
  149.      _P_E__s_t_a_r_t    The lowest virtual PE number of the active set of PEs.
  150.                  _P_E__s_t_a_r_t must be of type integer.  If you are using
  151.                  Fortran, it must be a default integer value.
  152.  
  153.      _l_o_g_P_E__s_t_r_i_d_e
  154.                  The log (base 2) of the stride between consecutive virtual
  155.                  PE numbers in the active set.  _l_o_g_P_E__s_t_r_i_d_e must be of
  156.                  type integer.  If you are using Fortran, it must be a
  157.                  default integer value.
  158.  
  159.      _P_E__s_i_z_e     The number of PEs in the active set.  _P_E__s_i_z_e must be of
  160.                  type integer.  If you are using Fortran, it must be a
  161.                  default integer value.
  162.  
  163.      _p_W_r_k        A symmetric work array.  The _p_W_r_k argument must have the
  164.                  same data type as _t_a_r_g_e_t.
  165.  
  166.                  In C/C++, this contains
  167.                  mmmmaaaaxxxx((((_n_r_e_d_u_c_e////2222 ++++ 1111,,,, ____SSSSHHHHMMMMEEEEMMMM____RRRREEEEDDDDUUUUCCCCEEEE____MMMMIIIINNNN____WWWWRRRRKKKKDDDDAAAATTTTAAAA____SSSSIIIIZZZZEEEE))))
  168.                  elements.
  169.  
  170.                  In Fortran, this contains
  171.                  mmmmaaaaxxxx((((_n_r_e_d_u_c_e////2222 ++++ 1111,,,, SSSSHHHHMMMMEEEEMMMM____RRRREEEEDDDDUUUUCCCCEEEE____MMMMIIIINNNN____WWWWRRRRKKKKDDDDAAAATTTTAAAA____SSSSIIIIZZZZEEEE))))
  172.                  elements.
  173.  
  174.      _p_S_y_n_c       A symmetric work array.
  175.  
  176.                  In C/C++, _p_S_y_n_c is of type lllloooonnnngggg and size
  177.                  ____SSSSHHHHMMMMEEEEMMMM____RRRREEEEDDDDUUUUCCCCEEEE____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE.
  178.  
  179.                  In Fortran, _p_S_y_n_c is of type integer and size
  180.                  SSSSHHHHMMMMEEEEMMMM____RRRREEEEDDDDUUUUCCCCEEEE____SSSSYYYYNNNNCCCC____SSSSIIIIZZZZEEEE.  It must be a default integer
  181.                  value.
  182.  
  183.                  Every element of this array must be initialized with the
  184.                  value ____SSSSHHHHMMMMEEEEMMMM____SSSSYYYYNNNNCCCC____VVVVAAAALLLLUUUUEEEE (in C/C++) or SSSSHHHHMMMMEEEEMMMM____SSSSYYYYNNNNCCCC____VVVVAAAALLLLUUUUEEEE (in
  185.                  Fortran) before any of the PEs in the active set enter the
  186.                  reduction routine.
  187.  
  188.      The values of arguments _n_r_e_d_u_c_e, _P_E__s_t_a_r_t, _l_o_g_P_E__s_t_r_i_d_e, and _P_E__s_i_z_e
  189.      must be equal on all PEs in the active set.  The same _t_a_r_g_e_t and
  190.      _s_o_u_r_c_e arrays, and the same _p_W_r_k and _p_S_y_n_c work arrays, must be passed
  191.      to all PEs in the active set.
  192.  
  193.      Before any PE calls a reduction routine, you must ensure that the
  194.      following conditions exist (synchronization via a barrier or some
  195.      other method is often needed to ensure this):
  196.  
  197.      * The _p_W_r_k and _p_S_y_n_c arrays on all PEs in the active set are not still
  198.        in use from a prior call to a collective SHMEM routine.
  199.  
  200.      * The _t_a_r_g_e_t array on all PEs in the active set is ready to accept the
  201.        results of the reduction.
  202.  
  203.      Upon return from a reduction routine, the following are true for the
  204.      local PE:
  205.  
  206.      * The _t_a_r_g_e_t array is updated.
  207.  
  208.      * The data cache region mapped to _t_a_r_g_e_t is coherent.
  209.  
  210.      * The values in the _p_S_y_n_c array are restored to the original values.
  211.  
  212. NNNNOOOOTTTTEEEESSSS
  213.      The terms _c_o_l_l_e_c_t_i_v_e, _s_y_m_m_e_t_r_i_c, and _c_a_c_h_e _a_l_i_g_n_e_d are defined in
  214.      iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3).
  215.  
  216.      All SHMEM reduction routines reset the values in _p_S_y_n_c before they
  217.      return, so a particular _p_S_y_n_c buffer need only be initialized the
  218.      first time it is used.
  219.  
  220.      You must ensure that the _p_S_y_n_c array is not being updated on any PE in
  221.      the active set while any of the PEs participate in processing of a
  222.      SHMEM reduction routine.  Be careful of the following situations:
  223.  
  224.      * If the _p_S_y_n_c array is initialized at run time, some type of
  225.        synchronization is needed to ensure that all PEs in the working set
  226.        have initialized _p_S_y_n_c before any of them enter a SHMEM routine
  227.        called with the _p_S_y_n_c synchronization array.
  228.  
  229.      * A _p_S_y_n_c or _p_W_r_k array can be reused in a subsequent reduction
  230.        routine call only if none of the PEs in the active set are still
  231.        processing a prior reduction routine call that used the same _p_S_y_n_c
  232.        or _p_W_r_k arrays.  In general, this can be assured only by doing some
  233.        type of synchronization.  However, in the special case of reduction
  234.        routines being called with the same active set, you can allocate two
  235.        _p_S_y_n_c and _p_W_r_k arrays and alternate between them on successive
  236.        calls.
  237.  
  238. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  239.      Example 1:  This Fortran example statically initializes the _p_S_y_n_c
  240.      array and finds the sum of the real variable FFFFOOOOOOOO across all even PEs.
  241.  
  242.           INCLUDE "mpp/shmem.fh"
  243.  
  244.           INTEGER PSYNC(SHMEM_REDUCE_SYNC_SIZE)
  245.           DATA PSYNC /SHMEM_REDUCE_SYNC_SIZE*SHMEM_SYNC_VALUE/
  246.           PARAMETER (NR=1)
  247.           REAL FOO, FOOSUM, PWRK(MAX(NR/2+1,SHMEM_REDUCE_MIN_WRKDATA_SIZE))
  248.           COMMON /COM/ FOO, FOOSUM, PWRK
  249.           INTRINSIC MY_PE
  250.  
  251.           IF ( MOD(MY_PE(),2) .EQ. 0) THEN
  252.              CALL SHMEM_INT4_SUM_TO_ALL(FOOSUM, FOO, NR, 0, 1, N$PES/2,
  253.          &      PWRK, PSYNC)
  254.              PRINT*,'Result on PE ',MY_PE(),' is ',FOOSUM
  255.           ENDIF
  256.  
  257.      Example 2:  Consider the following C/C++ call:
  258.  
  259.           shmem_int_sum_to_all( target, source, 3, 0, 0, 8, pwrk, psync );
  260.  
  261.      The preceding call is more efficient, but semantically equivalent to,
  262.      the combination of the following calls:
  263.  
  264.           shmem_int_sum_to_all(&(target[0]), &(source[0]), 1, 0, 0, 8,
  265.              pwrk1, psync1);
  266.           shmem_int_sum_to_all(&(target[1]), &(source[1]), 1, 0, 0, 8,
  267.              pwrk2, psync2);
  268.           shmem_int_sum_to_all(&(target[2]), &(source[2]), 1, 0, 0, 8,
  269.              pwrk1, psync1);
  270.  
  271.      Note that two sets of _p_W_r_k and _p_S_y_n_c arrays are used alternately
  272.      because no synchronization is done between calls.
  273.  
  274. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  275.      iiiinnnnttttrrrroooo____sssshhhhmmmmeeeemmmm(3)
  276.  
  277.      _M_e_s_s_a_g_e _P_a_s_s_i_n_g _T_o_o_l_k_i_t: _M_P_I _P_r_o_g_r_a_m_m_e_r'_s _M_a_n_u_a_l
  278.